home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / uwserver.zip / uwserver.tar / h / uw_ipc.h < prev    next >
C/C++ Source or Header  |  1991-01-25  |  5KB  |  164 lines

  1. /*
  2.  *    uw IPC definitions
  3.  *
  4.  * Copyright 1986 by John D. Bruner.  All rights reserved.  Permission to
  5.  * copy this program is given provided that the copy is not sold and that
  6.  * this copyright notice is included.
  7.  */
  8.  
  9. #ifndef UW_IPC
  10. #define    UW_IPC
  11.  
  12. /*
  13.  * UW accepts network connections in both the UNIX domain and the
  14.  * Internet domain.  UNIX domain datagrams are used by processes on
  15.  * the local machine to create new windows and to change the value
  16.  * of window parameters (window options).  TCP (Internet stream)
  17.  * connections are used by local and non-local processes which wish
  18.  * to handle their own host activity (e.g. pseudo-terminal handling).
  19.  *
  20.  * Some of the definitions in this file duplicate definitions in the
  21.  * UW server source code, because this file is also intended for use
  22.  * with the UW library.
  23.  *
  24.  * The code which performs byte-order conversions knows the size of the
  25.  * types defined in this file (since there is no typeof() operator).
  26.  */
  27.  
  28. #define    UIPC_ENV    "UW_UIPC"    /* Unix-domain port environment var */
  29. #define    INET_ENV    "UW_INET"    /* Internet-domain port environ var */
  30.  
  31. typedef long uwid_t;            /* unique window identifier */
  32.  
  33. typedef short uwcmd_t;            /* commands: */
  34. #define    UWC_NEWW    0        /*    create new window */
  35. #define    UWC_NEWT    1        /*    create new tty window */
  36. #define    UWC_STATUS    2        /*    creation status message */
  37. #define    UWC_KILLW    3        /*    kill existing window */
  38. #define    UWC_OPTION    4        /*    act upon window option */
  39.  
  40. typedef short uwoptcmd_t;        /* option subcommands: */
  41. #define    UWOC_SET    0        /*    set value of option */
  42. #define    UWOC_ASK    2        /*    ask for value of option */
  43. #define    UWOC_DO        4        /*    report changes in value */
  44. #define    UWOC_DONT    5        /*    don't report changes */
  45. #define    UWOC_WILL    6        /*    will report changes */
  46. #define    UWOC_WONT    7        /*    won't report changes */
  47.  
  48. typedef short uwtype_t;            /* window type (see also uw_win.h): */
  49. #define    UWT_ADM31    0        /*    ADM-31 */
  50. #define    UWT_VT52    1        /*    VT-52 */
  51. #define    UWT_ANSI    2        /*    ANSI */
  52. #define    UWT_TEK4010    3        /*    Tektronix 4010 */
  53. #define    UWT_FTP        4        /*    file transfer */
  54. #define    UWT_PRINT    5        /*    output to Macintosh printer */
  55. #define    UWT_PLOT    6        /*    plot window */
  56.  
  57. typedef short uwopt_t;            /* window option number: */
  58. #define    UWOP_VIS    1        /*    visibility */
  59. #define    UWOP_TYPE    2        /*    window type */
  60. #define    UWOP_POS    3        /*    window position */
  61. #define    UWOP_TITLE    4        /*    window title */
  62. #define    UWOP_WSIZE    5        /*    window size (in bits) */
  63.  
  64. #define    UWOP_TSIZE    8        /*    terminal size (row,col) */
  65. #define    UWOP_TFONTSZ    9        /*    small/large font size */
  66. #define    UWOP_TCLIPB    10        /*    clipboard/mouse encoding */
  67. #define    UWOP_TBELL    11        /*    audible, visual bell */
  68. #define    UWOP_TCURS    12        /*    cursor shape */
  69.  
  70. union uwoptval {
  71.     unsigned char    uwov_1bit;
  72.     unsigned char    uwov_6bit;
  73.     unsigned short    uwov_12bit;
  74.     struct {
  75.         unsigned short v,h;
  76.     }        uwov_point;
  77.     char        uwov_string[256];
  78. };
  79.  
  80.  
  81. /*
  82.  * UWC_NEWW: create a new window
  83.  *
  84.  * This command is only valid when it is sent as the first message on an
  85.  * Internet stream socket.  The remote port is the data fd for the window.
  86.  * If a control fd is desired, its port number is contained in "uwnt_ctlport"
  87.  */
  88. struct uwneww {
  89.     uwid_t        uwnw_id;    /* unique window identifier */
  90.     uwtype_t    uwnw_type;    /* window type */
  91.     short        uwnw_ctlport;    /* port number of control fd */
  92. };
  93.  
  94. /*
  95.  * UWC_NEWT: create a new tty window
  96.  *
  97.  * This command is only valid when it is sent as a datagram to the Unix-domain
  98.  * socket.  It must be accompanied by an access right (file descriptor) for
  99.  * the master side of a pty.  The server takes over all responsibilities for
  100.  * this window.  "uwnt_pty" is variable-length.
  101.  */
  102. struct uwnewt {
  103.     uwid_t        uwnt_id;    /* unique window identifier */
  104.     uwtype_t    uwnt_type;    /* window type */
  105.     char        uwnt_pty[1];    /* name of associated pty */
  106. };
  107.  
  108. /*
  109.  * UWC_STATUS: status report for UWC_NEWW
  110.  *
  111.  * This type of packet is sent by the server to the data fd in response
  112.  * to a UWC_NEWW.  It specifies whether the window was successfully
  113.  * created and what unique ID was assigned.
  114.  */
  115. struct uwstatus {
  116.     uwid_t        uwst_id;    /* unique window identifier */
  117.     short        uwst_err;    /* error status */
  118.     short        uwst_errno;    /* UNIX error code (see <errno.h>) */
  119. };
  120.  
  121. /*
  122.  * UWC_KILLW: kill the window
  123.  *
  124.  * This command may be sent to either the Unix-domain socket or the control
  125.  * file descriptor of an external window.  In the latter case, "uwkw_id"
  126.  * must match the ID of the window associated with the file descriptor.
  127.  */
  128. struct uwkillw {
  129.     uwid_t        uwkw_id;    /* unique window identifier */
  130. };
  131.  
  132. /*
  133.  * UWC_OPTION: act upon window option
  134.  *
  135.  * This command may be sent to either the Unix-domain socket or the control
  136.  * file descriptor of an external window.  In the former case, only the
  137.  * UWOC_SET command is processed.
  138.  */
  139. struct uwoption {
  140.     uwid_t        uwop_id;    /* unique window identifier */
  141.     uwopt_t        uwop_opt;    /* option number */
  142.     uwoptcmd_t    uwop_cmd;    /* option subcommand */
  143.     union uwoptval    uwop_val;    /* option value (for UWOC_SET) */
  144. };
  145.  
  146. struct uwipc {
  147.     unsigned short    uwip_len;    /* length of this message */
  148.     uwcmd_t        uwip_cmd;    /* command (message type) */
  149.     union {
  150.         struct uwneww uwipu_neww;
  151.         struct uwnewt uwipu_newt;
  152.         struct uwstatus uwipu_status;
  153.         struct uwkillw uwipu_killw;
  154.         struct uwoption uwipu_option;
  155.     }        uwip_u;
  156. #define    uwip_neww    uwip_u.uwipu_neww
  157. #define    uwip_newt    uwip_u.uwipu_newt
  158. #define    uwip_status    uwip_u.uwipu_status
  159. #define    uwip_killw    uwip_u.uwipu_killw
  160. #define    uwip_option    uwip_u.uwipu_option
  161. };
  162.  
  163. #endif
  164.